{{ header }}
<div class="container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
      <li class="breadcrumb-item"><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  {% if attention %}
    <div class="alert alert-info"><i class="fas fa-info-circle"></i> {{ attention }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
  {% endif %}
  {% if success %}
    <div class="alert alert-success alert-dismissible"><i class="fas fa-check-circle"></i> {{ success }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
  {% endif %}
  {% if error_warning %}
    <div class="alert alert-danger alert-dismissible"><i class="fas fa-exclamation-circle"></i> {{ error_warning }}
      <button type="button" class="close" data-dismiss="alert">&times;</button>
    </div>
  {% endif %}
  <div class="row">{{ column_left }}
    <div id="content" class="col">{{ content_top }}
      <h1>{{ heading_title }}</h1>
      {% if coupon or voucher or reward %}
        <div class="panel-group" id="accordion">{{ coupon }}{{ voucher }}{{ reward }}</div>
      {% endif %}
      {% if has_shipping %}
        {% if not shipping_methods %}
          <div class="warning">{{ error_no_shipping }}</div>
        {% else %}
          <form action="{{ action_shipping }}" method="post" id="shipping_form">
            <div class="card-body"> {% for shipping_method in shipping_methods %}
                <p><strong>{{ shipping_method.title }}</strong></p>
                {% if not shipping_method.error %}
                  {% for quote in shipping_method.quote %}
                    <div class="form-check">
                      <label>
                        {% if quote.code == code or not code %}
                          {% set code = quote.code %}
                          <input type="radio" name="shipping_method" value="{{ quote.code }}" id="{{ quote.code }}" class="form-check-input" checked="checked"/>
                        {% else %}
                          <input type="radio" name="shipping_method" value="{{ quote.code }}" id="{{ quote.code }}" class="form-check-input"/>
                        {% endif %}
                        {{ quote.title }}
                      </label>
                    </div>
                  {% endfor %}
                {% else %}
                  <div class="warning">{{ shipping_method.error }}</div>
                {% endif %}
              {% endfor %}
            </div>
          </form>
        {% endif %}
      {% endif %}
      <div class="table-responsive">
        <table class="table table-bordered">
          <thead>
            <tr>
              <td class="text-left">{{ column_name }}</td>
              <td class="text-left">{{ column_model }}</td>
              <td class="text-center">{{ column_quantity }}</td>
              <td class="text-right">{{ column_price }}</td>
              <td class="text-right">{{ column_total }}</td>
            </tr>
          </thead>
          <tbody>
            {% for product in products %}
              <tr>
                <td class="text-left"><a href="{{ product.href }}">{{ product.name }}</a> {% for option in product.option %}
                    <br/>
                    <small> - {{ option.name }}: {{ option.value }}</small> {% endfor %}
                  {% if product.recurring %}
                    <br/>
                    <span class="label label-info">{{ text_recurring_item }}</span>
                    <small>{{ product.recurring_description }}</small> {% endif %}</td>
                <td class="text-left">{{ product.model }}</td>
                <td class="text-center">{{ product.quantity }}</td>
                <td class="text-right">{{ product.price }}</td>
                <td class="text-right">{{ product.total }}</td>
              </tr>
            {% endfor %}
            {% for voucher in vouchers %}
              <tr>
                <td class="text-left">{{ voucher.description }}</td>
                <td class="text-left"></td>
                <td class="text-center">1</td>
                <td class="text-right">{{ voucher.amount }}</td>
                <td class="text-right">{{ voucher.amount }}</td>
              </tr>
            {% endfor %}
          </tbody>
        </table>
      </div>
      <br/>
      <div class="row">
        <div class="col-md-4 offset-md-8">
          <table class="table table-bordered">
            {% for total in totals %}
              <tr>
                <td class="text-right"><strong>{{ total.title }}:</strong></td>
                <td class="text-right">{{ total.text }}</td>
              </tr>
            {% endfor %}
          </table>
        </div>
      </div>
      <div class="d-inline-block pt-2 pd-2 w-100">
        <div class="float-right"><a href="{{ action_confirm }}" class="btn btn-primary">{{ button_confirm }}</a></div>
      </div>
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>
{{ footer }}
<script type="text/javascript"><!--
$('input[name=\'shipping_method\']').change(function() {
	$('#shipping_form').submit();
});

$('input[name=\'next\']').bind('change', function() {
	$('.cart-discounts > div').hide();

	$('#' + this.value).show();
});
//--></script>
